<template>
  <div class="block">
    <el-empty :image-size="200" v-if="activityList.length <= 0" style="margin-left: -75px"
              description="暂时没有活动信息~~"
    ></el-empty>
    <el-timeline v-else reverse>
      <el-timeline-item
        v-for="(activity, index) in activityList"
        :key="index"
        :type="activityList.length == index + 1 ? 'primary':'success'"
        :timestamp="activity.createTime.split(' ')[0]"
        class="timelineitem"
      >
        <el-row style="top: 9px">
          <el-col style="width: 8%">
            <div class="reocrds-time">
              {{ activity.createTime.split(' ')[1] }}
            </div>
          </el-col>
          <el-col style="width: 6%">
            <div class="records-avatar">
              <el-avatar size="medium">
                <div style="background: #108fff">
                  {{
                    activity.createUserName.length >= 2 ? activity.createUserName.substring(activity.createUserName.length - 2, activity.createUserName.length) : activity.createUserName
                  }}
                </div>
              </el-avatar>
            </div>
          </el-col>
          <el-col style="width: 10%">
            <div class="records-name">
              {{ activity.createUserName }}
            </div>
          </el-col>
          <el-col style="width: 76%">
            <div class="records-context">
              <div>
                <el-tag effect="dark" size="small" v-if="activity.behavior == 1">新增</el-tag>
                <el-tag effect="dark" type="danger" size="small" v-else-if="activity.behavior == 2">删除</el-tag>
                <el-tag effect="dark" type="warning" size="small" v-else-if="activity.behavior == 3">修改</el-tag>
                <el-tag effect="dark" type="success" size="small" v-else-if="activity.behavior == 4">转化</el-tag>
              </div>
              <ul v-for="(item,index) in activity.detail.split('；')" class="defPositionOutside">
                <li>{{ item }}</li>
              </ul>
            </div>
          </el-col>
        </el-row>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
export default {
  name: 'CrmRecords',
  components: {},
  props: {
    activityList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {}
  },
  // 在实例创建完成后被立即调用
  created() {

  },
  // 实例被挂在后调用
  mounted() {
  },
  // 方法
  methods: {}
}
</script>
<style scoped lang="scss">

::v-deep .el-timeline-item__timestamp.is-bottom {
  position: absolute;
  left: -100px;
  top: 9px;
  font-size: 16px;
  font-weight: 500;
  color: #1e1e1e;
}

::v-deep .el-timeline-item__tail {
  height: 202%;
  top: 16px
}

::v-deep .el-timeline-item__node {
  top: 16px;
}

::v-deep .el-descriptions__title {
  display: flex;
}

.block {
  margin-left: 75px;

  .timelineitem {

    .myeditor2 {
      height: auto;
      min-height: 10px;
      margin-top: 10px;
    }
  }
}

.div-inline {
  display: inline-block;
  white-space: nowrap;
}

.recores-cont {
  display: flex;
  min-height: 40px;
  justify-content: flex-start;
  align-items: stretch;
  top: 9px;
}

.reocrds-time {
  vertical-align: top;
  font-size: 16px;
  font-weight: 500;
  padding: 4px 8px 0 8px;
}

.records-avatar {
  vertical-align: top;
  padding: 4px 8px 0 8px;
}

.records-name {
  vertical-align: top;
  font-size: 16px;
  font-weight: 500;
  padding: 4px 8px 0 8px;
}

.records-context {
  text-align: justify;
  vertical-align: top;
  font-size: 14px;
  padding: 4px 12px 0 0px;
}

.defPositionOutside {
  list-style-position: outside;
  margin-left: -40px;
}

.defPositionOutside ul{
  list-style:none;    //去掉标签默认的左边符号
  display:flex;
  flex-wrap:wrap;
}
.defPositionOutside li{
  list-style-type:none;
  line-height: 26px;
  font-size: 14px;
}
.defPositionOutside li::before{
  content: "●";
  font-size: 14px;
  color: #5c8efd;
  padding-right:8px;
}
</style>
